package com.ybf.api.mapper.provider;

import com.ybf.api.entity.FileDetails;
import org.apache.ibatis.annotations.Param;

public class FileDetailsProvider {
    public StringBuilder findAll(@Param("filedetails") FileDetails filedetails) {
        StringBuilder sql = new StringBuilder("select id, filename, filepath, filesize, filetype, hash, description, created_by, created_at, updated_at, status from file_list where 1 = 1");
        if(filedetails.getStatus() != null) {
            sql.append(" and status = #{filedetails.status}");
        }
        if(filedetails.getHash() != null) {
            sql.append(" and hash = #{filedetails.hash}");
        }
        return sql;
    }
}
